package top.zywork.enums;

import lombok.Getter;
import lombok.ToString;

/**
 * @author Animo blog
 */
@Getter
public enum SchoolOrderStatusEnum {

    /**
     * 待接单、已接单、配送中、已完成
     */
    WAITING_LIST(0,"待接单"),
    HAVE_ORDER(1,"已接单"),
    IN_THE_DISTRIBUTION(2,"配送中"),
    HAS_BEEN_COMPLETED(3,"已完成");


    private Integer code;

    private String value;



    SchoolOrderStatusEnum(Integer code, String value) {
        this.code = code;
        this.value = value;
    }

    @Override
    public String toString() {
        return "SchoolOrderStatusEnum{" +
                "code=" + code +
                ", value='" + value + '\'' +
                '}';
    }

    public static SchoolOrderStatusEnum getEnum(Integer code){
        SchoolOrderStatusEnum[] values = SchoolOrderStatusEnum.values();
        for(SchoolOrderStatusEnum schoolOrderStatusEnum : values){
            if(schoolOrderStatusEnum.getCode().equals(code)){
                return schoolOrderStatusEnum;
            }
        }
        return null;
    }
}
